package com.java.example.util;

import android.text.TextUtils;
import android.util.Log;

import com.java.example.bean.MultipleItemEntity;

import java.util.ArrayList;
import java.util.List;

public abstract class DataConverter {
    protected final ArrayList<MultipleItemEntity> ENTITIES=new ArrayList<>();

    private String mJsonData=null;

    public abstract ArrayList<MultipleItemEntity> convert();

    public abstract List<MultipleItemEntity> filter(List<MultipleItemEntity> sourceData, List<MultipleItemEntity> targetData);

    public DataConverter setJsonData(String json){
        this.mJsonData=json;
        return this;
    }

    protected String getJsonData(){
        if(TextUtils.isEmpty(mJsonData)){
            Log.i("AAAA","DATA IS NULL");
            mJsonData="";
//            throw new NullPointerException("DATA IS NULL!");
        }
        return mJsonData;
    }

    public abstract int getArraySize();

}
